"use strict";

var _createClass = function () {
    function defineProperties(target, props) {
        for (var i = 0; i < props.length; i++) {
            var descriptor = props[i];
            descriptor.enumerable = descriptor.enumerable || false;
            descriptor.configurable = true;
            if ("value" in descriptor) descriptor.writable = true;
            Object.defineProperty(target, descriptor.key, descriptor);
        }
    }
    return function (Constructor, protoProps, staticProps) {
        if (protoProps) defineProperties(Constructor.prototype, protoProps);
        if (staticProps) defineProperties(Constructor, staticProps);
        return Constructor;
    };
}();

function _classCallCheck(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
    }
}

// function classDecorator(target) {
//     target.hasDecorator = true
//     return target
// }

function funcDecorator(target, name, descriptor) {
    var originalMethod = descriptor.value;
    descriptor.value = function () {
        console.log('我是Func的装饰器逻辑');
        return originalMethod.apply(this, arguments);
    };
    return descriptor;
}

// @classDecorator

var Button = function () {
    function Button() {
        _classCallCheck(this, Button);
    }

    _createClass(Button, [{
        key: "onClick",

        // @funcDecorator
        value: function onClick() {
            console.log("我是Func的原有逻辑");
        }
    }]);

    return Button;
}();

// console.log("Button 被装饰了", Button.hasDecorator)


var btn = new Button();
btn.onClick();